import { EVENTS } from '../../../events';
import { ConditionFactory } from '../../../systems/condition-checker/factory';
import { ITEM_ID } from '../../item';
import type { StoryConfig, StoryItem } from '../type';

export const baiZhanBuDaiCultivationSkillStoryItems: StoryItem[] = [
  {
    id: '1',
    type: 'narrator',
    text: [
      '灯笼下，黑衣人盘腿而坐，面前一块破布，摆着一本功法。',
      '你走近一看，此功法名为——《百战不殆》。',
    ],
    next: '2',
  },
  {
    id: '2',
    type: 'choice',
    text: [],
    choices: [
      {
        text: '这本功法多少灵石？',
        next: '3',
      },
    ],
  },
  {
    id: '3',
    type: 'dialog',
    name: '黑衣人-少安（沙哑）',
    text: ['五百万灵石。'],
    next: '4',
  },
  {
    id: '4',
    type: 'choice',
    text: [],
    choices: [
      {
        text: '支付灵石',
        next: 'deals-done',
        failNext: 'stone-not-enough',
        condition: [ConditionFactory.createStoneCondition(5000000)],
        events: [
          {
            cmd: EVENTS.INVENTORY_ADD,
            itemId: ITEM_ID.BAI_ZHAN_BU_DAI,
            amount: 1,
          },
          {
            cmd: EVENTS.WALLET_DEDUCT_SPIRIT_STONE,
            amount: 5000000,
          },
        ],
      },
      {
        text: '能不能便宜点，我真心想要',
        next: '5',
      },
    ],
  },
  {
    id: '5',
    type: 'dialog',
    name: '黑衣人-少安（思考）',
    text: ['一百万灵石，不能再少。'],
    next: '6',
  },
  {
    id: '6',
    type: 'choice',
    text: [],
    choices: [
      {
        text: '支付灵石',
        next: 'deals-done',
        failNext: 'stone-not-enough',
        condition: [ConditionFactory.createStoneCondition(1000000)],
        events: [
          {
            cmd: EVENTS.INVENTORY_ADD,
            itemId: ITEM_ID.BAI_ZHAN_BU_DAI,
            amount: 1,
          },
          {
            cmd: EVENTS.WALLET_DEDUCT_SPIRIT_STONE,
            amount: 1000000,
          },
        ],
      },
      {
        text: '离开',
        next: 'leave',
      },
    ],
  },
  {
    id: 'stone-not-enough',
    type: 'dialog',
    name: '黑衣人-少安（沙哑）',
    text: ['你的灵石不够，下次再来吧。'],
    next: undefined,
  },
  {
    id: 'deals-done',
    type: 'dialog',
    name: '黑衣人-少安（奸笑）',
    text: ['桀桀桀~~~多谢道友关照，下次有好东西还卖给你。'],
    next: undefined,
  },
  {
    id: 'leave',
    type: 'dialog',
    name: '黑衣人-少安（不悦）',
    text: ['没钱也敢来买东西。'],
    next: undefined,
  },
];

export const baiZhanBuDaiCultivationSkillStory: StoryConfig = {
  items: baiZhanBuDaiCultivationSkillStoryItems,
};
